function [MaxLag,MaxLead] = mymaxshift(This)
% mymaxshift  [Not a public function] Actual max lag and max lead.
%
% Backend IRIS function.
% No help provided.

% -IRIS Toolbox.
% -Copyright (c) 2007-2015 IRIS Solutions Team.

%--------------------------------------------------------------------------

nEqtn = length(This.eqtn);
nName = length(This.name);
nSh = length(This.Shift);
occ = full(This.occur);
occ = reshape(occ,[nEqtn,nName,nSh]);

posZero = find(This.Shift==0);
occ = any(any(occ,1),2);
MaxLag = find(occ,1) - posZero;
MaxLead = find(occ,1,'last') - posZero;

end